<section class="title">
<?php if ($this->method == 'create'): ?>
	<h4><?php echo lang('escort_user_role_create_title'); ?></h4>	<?php $readonly = ""; ?>
		<?php else: ?>
	<h4><?php echo sprintf(lang('escort_user_role_edit_title'), $user->username); ?></h4>
	<?php $readonly = 'readonly="readonly"'; ?>
<?php endif; ?>
</section>

<section class="item">
	
<?php echo form_open(uri_string(), 'class="crud" '); ?>
<div class="form_inputs" id="news-form">

	<fieldset>
	
		<ul>
			<li class="even multi-column">
				<ul>
					<li>
						<label for="group"><?php echo lang('escort_user_role_group_label'); ?></label>
						<div class="input"><?php echo form_dropdown('group', $groups, $user->group, 'maxlength="100"'); ?></div>
					</li>
					<li>
						<label for="name"><?php echo lang('escort_user_role_name_label'); ?></label>
						<div class="input"><?php echo form_input('name', $user->name, 'maxlength="100"'); ?></div>
					</li>
				</ul>
								
			</li>
			<li class="odd multi-column">
				<ul>
					<li>
						<label for="username"><?php echo lang('escort_user_role_username_label'); ?> <span>*</span></label>
						<div class="input"><?php echo form_input('username', $user->username, 'maxlength="100" '.$readonly.''); ?></div>
					</li>
					<li>
						<label for="phone"><?php echo lang('escort_user_role_phone_label'); ?> <span>*</span></label>
						<div class="input"><?php echo form_input('phone', $user->phone, 'maxlength="100"'); ?></div>
					</li>
				</ul>				
			</li>
			<li class="odd multi-column">
				<ul>
					<li>
						<label for="password"><?php echo lang('escort_user_role_password_label'); ?> <span>*</span></label>
						<div class="input"><?php echo form_password('password', '', 'maxlength="100"'); ?></div>
					</li>
					<li>
						<label for="email"><?php echo lang('escort_user_role_email_label'); ?> <span>*</span></label>
						<div class="input"><?php echo form_input('email', $user->email, 'maxlength="100"'); ?></div>
					</li>
				</ul>				
			</li>
			<li class="odd multi-column">
			<ul>
			<li>
			<label for="password"><?php echo lang('escort_user_role_retype_password_label'); ?> <span>*</span></label>
				<div class="input"><?php echo form_password('retype_password', '', 'maxlength="100"'); ?></div>
					</li>
					<li>
						<label for="address"><?php echo lang('escort_user_role_address_label'); ?> <span>*</span></label>
						<div class="input"><?php echo form_input('address', $user->address, 'maxlength="100"'); ?></div>
					</li>
				</ul>				
			</li>
			<?php
			if($userZones){
				$i = 0;
				foreach ($userZones as $userZone){
					$i++;
			?>
			<li class="even multi-item">
				<ul>
					<li>
						<?php echo form_dropdown('country_id[]', array('0' => lang('escort_user_role_all_country_label')) + getCountryData_ioc(), $userZone->country_id, 'id="country_'.$i.'" class="country_select"') ?>
					</li>
					<li>
						<?php echo form_dropdown('region_id[]', array('0' => lang('escort_user_role_all_state_label')) + getStateData_ioc($userZone->country_id), $userZone->state_id, 'id="state_country_'.$i.'" class="state_select"') ?>
					</li>
					<li id="province_state_country_<?php echo $i?>_wrapper" <?php echo $userZone->province_id?'':'style="display: none;"'?>>
						<?php echo form_dropdown('province_id[]', array('0' => lang('escort_user_role_all_provice_label')) + getProvinceData_ioc($userZone->country_id, $userZone->state_id), $userZone->province_id, 'id="province_state_country_'.$i.'" class="provice_select"') ?>
					</li>
					<li>
						<?php echo form_dropdown('city_id[]', array('0' => lang('escort_user_role_all_city_label')) + getCityData_ioc($userZone->country_id, $userZone->state_id, $userZone->province_id ),  $userZone->city_id, 'id="city_state_country_'.$i.'" class="city_select"') ?>
					</li>
					<li class="delete-zone">
						<?php echo anchor('#', lang('global:delete'), array('class'=>'btn red delete', 'onclick' => 'return deleteZone(this)'))?>
					</li>
				</ul>
			</li>
			<?php
				}
			}else{ 
			?>
			<li class="even multi-item">
				<ul>
					<li>
							<?php echo form_dropdown('country_id[]', array('0' => lang('escort_user_role_all_country_label')) + getCountryData_ioc(), '', 'id="country_1" class="country_select"') ?>
					</li>
					<li>
						
						<?php echo form_dropdown('region_id[]', array('0' => lang('escort_user_role_all_state_label')) + getStateData_ioc(0), '', 'id="state_country_1" class="state_select"') ?>
						
					</li>
					<li id="province_state_country_1_wrapper" style="display: none;">
						<?php echo form_dropdown('province_id[]', array('0' => lang('escort_user_role_all_provice_label')) + getProvinceData_ioc(), '', 'id="province_state_country_1" class="provice_select"') ?>
					</li>
					<li>
						<?php echo form_dropdown('city_id[]', array('0' => lang('escort_user_role_all_city_label')) + getCityData_ioc(), '', 'id="city_state_country_1" class="city_select"') ?>
					</li>
					<li class="delete-zone">
						<?php echo anchor('#', lang('global:delete'), array('class'=>'btn red delete', 'onclick' => 'return deleteZone(this)'))?>
					</li>
				</ul>
			</li>
			<?php
			} 
			?>
			<div id="add-more-zone-wrapper">
			</div>
			<li class="odd">
				<?php echo anchor('#', lang('escort_user_role_add_more_label'), array('class'=>'btn red', 'id' => 'add-more-zone')); ?>
			</li>
			
			<li class="odd">
				<label for="commission"><?php echo lang('escort_user_role_comission_label') ?></label>
				<div class="input"><?php echo form_input('comission',$user->comission, '')?></div>
			</li>
			<li class="odd">
				<label for="wallet"><?php echo lang('escort_user_role_wallet_label') ?></label>
				<div class="input"><?php echo form_input('wallet',$user->wallet, $readonly)?></div>
			</li>
			<li>
				<label for="status"><?php echo lang('escort_user_role_active_label')?></label>
				<div class="input"><?php echo form_checkbox('status', 1, $user->status)?></div>
			</li>
		</ul>
	</fieldset>
</div>
<div class="buttons float-right padding-top">
<?php $this->load->view('admin/partials/buttons', array('buttons' => array('save', 'save_exit', 'cancel'))); ?>
</div>
<?php echo form_close(); ?>
</section>
<div id='confirm'>
	<div class='header'><span><?php echo lang('escort_confirm')?></span></div>
	<div class='message'><?php echo lang('escort_delete_zone_message')?></div>
		<div class='buttons'>
		<div class='no simplemodal-close'><?php echo lang('escort_confirm_no')?></div><div class='yes'><?php echo lang('escort_confirm_yes')?></div>
	</div>
</div>